1
|
|
|
// BigBlueButton open source conferencing system - http://www.bigbluebutton.org/. |
2
|
|
|
// |
3
|
|
|
// Copyright (c) 2018 BigBlueButton Inc. and by respective authors (see below). |
4
|
|
|
// |
5
|
|
|
// This program is free software; you can redistribute it and/or modify it under the |
6
|
|
|
// terms of the GNU Lesser General Public License as published by the Free Software |
7
|
|
|
// Foundation; either version 3.0 of the License, or (at your option) any later |
8
|
|
|
// version. |
9
|
|
|
// |
10
|
|
|
// BigBlueButton is distributed in the hope that it will be useful, but WITHOUT ANY |
11
|
|
|
// WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
12
|
|
|
// PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details. |
13
|
|
|
// |
14
|
|
|
// You should have received a copy of the GNU Lesser General Public License along |
15
|
|
|
// with BigBlueButton; if not, see <http://www.gnu.org/licenses/>. |
16
|
|
|
|
17
|
|
|
$(document).on('turbolinks:load', function(){ |
18
|
|
|
var controller = $("body").data('controller'); |
19
|
|
|
var action = $("body").data('action'); |
20
|
|
|
|
21
|
|
|
// Only run on the admins page. |
22
|
|
|
if (controller == "admins" && action == "index") { |
23
|
|
|
// show the modal with the correct form action url |
24
|
|
|
$(".delete-user").click(function(data){ |
25
|
|
|
var uid = $(data.target).closest("tr").data("user-uid") |
26
|
|
|
var url = $("body").data("relative-root") |
27
|
|
|
if (!url.endsWith("/")) { |
28
|
|
|
url += "/" |
29
|
|
|
} |
30
|
|
|
url += "u/" + uid |
31
|
|
|
$("#delete-confirm").parent().attr("action", url) |
32
|
|
|
}) |
33
|
|
|
|
34
|
|
|
//clear the role filter if user clicks on the x |
35
|
|
|
$(".clear-role").click(function() { |
36
|
|
|
var search = new URL(location.href).searchParams.get('search') |
37
|
|
|
|
38
|
|
|
var url = window.location.pathname + "?page=1" |
39
|
|
|
|
40
|
|
|
if (search) { |
41
|
|
|
url += "&search=" + search |
42
|
|
|
} |
43
|
|
|
|
44
|
|
|
window.location.replace(url); |
45
|
|
|
}) |
46
|
|
|
|
47
|
|
|
/* COLOR SELECTORS */ |
48
|
|
|
|
49
|
|
|
loadColourSelectors() |
50
|
|
|
} |
51
|
|
|
|
52
|
|
|
// Only run on the admins edit user page. |
53
|
|
|
if (controller == "admins" && action == "edit_user") { |
54
|
|
|
$(".setting-btn").click(function(data){ |
55
|
|
|
var url = $("body").data("relative-root") |
56
|
|
|
if (!url.endsWith("/")) { |
57
|
|
|
url += "/" |
58
|
|
|
} |
59
|
|
|
url += "admins?setting=" + data.target.id |
60
|
|
|
|
61
|
|
|
window.location.href = url |
62
|
|
|
}) |
63
|
|
|
} |
64
|
|
|
}); |
65
|
|
|
|
66
|
|
|
// Change the branding image to the image provided |
67
|
|
|
function changeBrandingImage(path) { |
68
|
|
|
var url = $("#branding-url").val() |
69
|
|
|
$.post(path, {url: url}) |
70
|
|
|
} |
71
|
|
|
|
72
|
|
|
// Filters by role |
73
|
|
|
function filterRole(role) { |
74
|
|
|
var search = new URL(location.href).searchParams.get('search') |
75
|
|
|
|
76
|
|
|
var url = window.location.pathname + "?page=1" + "&role=" + role |
77
|
|
|
|
78
|
|
|
if (search) { |
79
|
|
|
url += "&search=" + search |
80
|
|
|
} |
81
|
|
|
|
82
|
|
|
window.location.replace(url); |
83
|
|
|
} |
84
|
|
|
|
85
|
|
|
function loadColourSelectors() { |
86
|
|
|
const pickrRegular = new Pickr({ |
87
|
|
|
el: '#colorinput-regular', |
88
|
|
|
theme: 'monolith', |
89
|
|
|
useAsButton: true, |
90
|
|
|
lockOpacity: true, |
91
|
|
|
defaultRepresentation: 'HEX', |
92
|
|
|
closeWithKey: 'Enter', |
93
|
|
|
default: $("#colorinput-regular").css("background-color"), |
94
|
|
|
|
95
|
|
|
components: { |
96
|
|
|
palette: true, |
97
|
|
|
preview: true, |
98
|
|
|
hue: true, |
99
|
|
|
interaction: { |
100
|
|
|
input: true, |
101
|
|
|
save: true, |
102
|
|
|
}, |
103
|
|
|
}, |
104
|
|
|
}); |
105
|
|
|
|
106
|
|
|
const pickrLighten = new Pickr({ |
107
|
|
|
el: '#colorinput-lighten', |
108
|
|
|
theme: 'monolith', |
109
|
|
|
useAsButton: true, |
110
|
|
|
lockOpacity: true, |
111
|
|
|
defaultRepresentation: 'HEX', |
112
|
|
|
closeWithKey: 'Enter', |
113
|
|
|
default: $("#colorinput-lighten").css("background-color"), |
114
|
|
|
|
115
|
|
|
components: { |
116
|
|
|
palette: true, |
117
|
|
|
preview: true, |
118
|
|
|
hue: true, |
119
|
|
|
interaction: { |
120
|
|
|
input: true, |
121
|
|
|
save: true, |
122
|
|
|
}, |
123
|
|
|
}, |
124
|
|
|
}); |
125
|
|
|
|
126
|
|
|
const pickrDarken = new Pickr({ |
127
|
|
|
el: '#colorinput-darken', |
128
|
|
|
theme: 'monolith', |
129
|
|
|
useAsButton: true, |
130
|
|
|
lockOpacity: true, |
131
|
|
|
defaultRepresentation: 'HEX', |
132
|
|
|
closeWithKey: 'Enter', |
133
|
|
|
default: $("#colorinput-darken").css("background-color"), |
134
|
|
|
|
135
|
|
|
components: { |
136
|
|
|
palette: true, |
137
|
|
|
preview: true, |
138
|
|
|
hue: true, |
139
|
|
|
interaction: { |
140
|
|
|
input: true, |
141
|
|
|
save: true, |
142
|
|
|
}, |
143
|
|
|
}, |
144
|
|
|
}); |
145
|
|
|
|
146
|
|
|
pickrRegular.on("save", (color, instance) => { |
147
|
|
|
$.post($("#coloring-path-regular").val(), {color: color.toHEXA().toString()}).done(function() { |
148
|
|
|
location.reload() |
149
|
|
|
}); |
150
|
|
|
}) |
151
|
|
|
|
152
|
|
|
pickrLighten.on("save", (color, instance) => { |
153
|
|
|
$.post($("#coloring-path-lighten").val(), {color: color.toHEXA().toString()}).done(function() { |
154
|
|
|
location.reload() |
155
|
|
|
}); |
156
|
|
|
}) |
157
|
|
|
|
158
|
|
|
pickrDarken.on("save", (color, instance) => { |
159
|
|
|
$.post($("#coloring-path-darken").val(), {color: color.toHEXA().toString()}).done(function() { |
160
|
|
|
location.reload() |
161
|
|
|
}); |
162
|
|
|
}) |
163
|
|
|
} |